package jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class JdbcDemo03 {
    public static void main(String[] args) throws Exception {
        try (
                Connection connection = DbUtil.getConnection();
                ){

            Statement statement = connection.createStatement();
            String str = "UPDATE userinfo SET password = '456789' WHERE username = '李星云'";
            int num = statement.executeUpdate(str);
            if (num > 0) {
                System.out.println("修改成功");
            } else {
                System.out.println("修改失败");
            }
        } catch (SQLException e){
            e.printStackTrace();
        }
    }
}